<!--
*Author：
 *Contact：
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/system/workbusiness/EQU_COM_DEFINITION_TASK.js此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
     <!-- 连接状态提示 
     <div v-if="connectionError" class="error-alert">
        连接错误: {{ connectionError }}
        <button @click="setHideErrorMessage">隐藏错误</button>
      </div>

  <button @click="setErrorMessage">发送请求</button>-->
  
</template>
<script>
    import extend from "@/extension/system/workbusiness/EQU_COM_DEFINITION_TASK.js";
    import { ref, defineComponent } from "vue";
    
    export default defineComponent({
        setup() {
            const connectionError = ref(null)
            // 更新错误信息的方法
    const setErrorMessage = () => {
        connectionError.value = ",";
        //"连接错误: 连接失败，请检查网络或服务器状态";  
    }
    const setHideErrorMessage = () => {
        connectionError.value = null;  
    }
            const table = ref({
                key: 'ComDefintion_TaskId',
                footer: "Foots",
                cnName: '调度任务',
                name: 'workbusiness/EQU_COM_DEFINITION_TASK',
                url: "/EQU_COM_DEFINITION_TASK/",
                sortName: "OrderCode,ActionSort desc,SecornSeq"
            });
            const editFormFields = ref({"Command":"","Equipment_Id":"","MovePath_Id":"","MovePathSub_Id":"","ExecuteStart":"","Source":"","IpUrl":"","ExecuteEnd":"","SubPathNo":"","ActionEquipmentId":"","EQUTask_Id":"","TaskType":""});
            const editFormOptions = ref([[{"title":"指令","field":"Command","type":"text"},
                               {"dataKey":"设备机床","data":[],"title":"设备","field":"Equipment_Id","type":"select"},
                               {"title":"路径","field":"MovePath_Id","type":"text"},
                               {"dataKey":"路径点","data":[],"title":"路径点","field":"MovePathSub_Id","type":"select"}],
                              [{"title":"执行开始时间","field":"ExecuteStart","type":"datetime"},
                               {"title":"来源","field":"Source","type":"text"},
                               {"title":"Ip","field":"IpUrl","type":"text"}],
                              [{"title":"执行结束时间","field":"ExecuteEnd","type":"datetime"},
                               {"title":"路径序号","field":"SubPathNo","type":"text"},
                               {"dataKey":"设备","data":[],"title":"执行设备","field":"ActionEquipmentId","type":"select"}],
                              [{"dataKey":"任务类型","data":[],"title":"任务类型","field":"EQUTask_Id","type":"select"}],
                              [{"dataKey":"调度任务类型","data":[],"title":"任务类型","field":"TaskType","type":"select"}]]);
            const searchFormFields = ref({"OrderCode":"","Status":"","Equipment_Id":"","TaskType":"","IsCurrentOrderCode":""});
            const searchFormOptions = ref([[{"dataKey":"工单（没有Id）","data":[],"title":"工单","field":"OrderCode","type":"select"},{"dataKey":"设备机床","data":[],"title":"设备","field":"Equipment_Id","type":"select"},{"dataKey":"任务状态","data":[],"title":"任务状态","field":"Status","type":"select"},{"dataKey":"调度任务类型","data":[],"title":"任务类型","field":"TaskType","type":"select"},{"dataKey":"是否当前工单","data":[],"title":"工单(是否当前设备执行工单)","field":"IsCurrentOrderCode","type":"select"}]]);
            const columns = ref([{field:'TaskNo',title:'任务No.',type:'string',width:220,require:true,align:'left',sort:true},
                       {field:'ComDefintion_TaskId',title:'ComDefintion_TaskId',type:'guid',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'OperationName',title:'工序',type:'string',width:80,align:'left'},
                       {field:'OrderCode',title:'工单',type:'string',bind:{ key:'工单（没有Id）',data:[]},width:160,align:'left'},
                       {field:'ActionSubPathNo',title:'执行路径',type:'int',width:80,hidden:true,align:'left'},
                       {field:'ActionSort',title:'执行顺序',type:'decimal',sort:true,width:80,align:'left'},
                       {field:'ProgramId',title:'程序',type:'string',bind:{ key:'程序',data:[]},width:90,align:'left'},
                       {field:'Status',title:'任务状态',type:'string',bind:{ key:'任务状态',data:[]},width:100,align:'left'},
                       {field:'EQUTask_Id',title:'任务类型',type:'string',bind:{ key:'任务类型',data:[]},width:130,align:'left'},
                       {field:'Command',title:'指令',type:'string',width:110,align:'left'},
                       {field:'ExecuteStart',title:'执行开始时间',type:'datetime',width:110,align:'left',sort:true},
                       {field:'ExecuteEnd',title:'执行结束时间',type:'datetime',width:110,align:'left',sort:true},
                       {field:'ExecuteTaskDiffTime',title:'执行时间',type:'int',width:80,align:'left'},
                       {field:'Equipment_Id',title:'设备',type:'string',bind:{ key:'设备机床',data:[]},width:110,align:'left'},
                       {field:'ComDefintionTaskNameZH',title:'指令任务名',type:'string',width:110,hidden:true,align:'left'},
                       {field:'MovePath_Id',title:'路径',type:'string',width:110,hidden:true,align:'left'},
                       {field:'MovePathSub_Id',title:'路径点',type:'string',bind:{ key:'路径点',data:[]},width:110,hidden:true,align:'left'},
                       {field:'SubPathNo',title:'路径序号',type:'int',width:110,hidden:true,align:'left'},
                       {field:'SHELVES_Id',title:'工件刀具点',type:'string',bind:{ key:'货架点位带数字',data:[]},width:130,align:'left'},
                       {field:'ActionEquipmentId',title:'执行设备',type:'string',bind:{ key:'设备',data:[]},sort:true,width:120,align:'left'},
                       {field:'TaskType',title:'任务类型',type:'string',bind:{ key:'调度任务类型',data:[]},width:110,hidden:true,align:'left'},
                       {field:'Description',title:'描述',type:'string',width:220,align:'left'},
                       {field:'CreateBy',title:'创建人',type:'string',width:110,align:'left'},
                       {field:'CreateOn',title:'创建时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'UpdateBy',title:'更新人',type:'string',width:110,hidden:true,align:'left'},
                       {field:'LastUpdateOn',title:'更新时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
                       {field:'IsDeleted',title:'逻辑删除 0/不删除 1/已删除',type:'bool',width:110,hidden:true,align:'left'},
                       {field:'Source',title:'来源',type:'string',width:110,hidden:true,align:'left'},
                       {field:'IpUrl',title:'Ip',type:'string',width:110,hidden:true,align:'left'},
                       {field:'SecornSeq',title:'第二序',type:'int',width:80,align:'left'},
                       {field:'time',title:'时长',type:'string',width:120,hidden:true,align:'left'},
                       {field:'ToolId',title:'刀',type:'string',width:120,align:'left'},
                       {field:'ProcessingNumber',title:'加工中序号',type:'decimal',width:110,align:'left'},
                       {field:'IsCurrentOrderCode',title:'工单(是否当前设备执行工单)',type:'string',bind:{ key:'是否当前工单',data:[]},width:110,align:'left'},
                       {field:'IsActivation',title:'工单激活 1 激活',type:'string',width:110,align:'left'}]);
            const detail = ref({
                cnName: "#detailCnName",
                table: "#detailTable",
                columns: [],
                sortName: "",
                key: ""
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
                connectionError,
                setErrorMessage,
                setHideErrorMessage,
            };
        },
    });
</script>
<style scoped>
    /* 错误提示 */
 
</style>
